fix: panel not follow when scroll is visible#76
fix: panel not follow when scroll is visible#76zombieJ merged 3 commits intoreact-component:masterfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough在 Changes
Sequence Diagram(s)sequenceDiagram
participant 组件 as Component
participant 窗口 as Window
participant Hook as useTarget钩子
participant update as updatePos函数
组件->>Hook: 初始化组件
Hook->>窗口: 注册 scroll 事件监听器
窗口->>update: scroll事件发生
update-->>Hook: 更新目标元素位置
组件-->>Hook: 组件卸载
Hook->>窗口: 移除 scroll 事件监听器
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
tests/index.test.tsxOops! Something went wrong! :( ESLint: 7.32.0 ESLint couldn't find the plugin "eslint-plugin-react". (The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.js » /node_modules/.pnpm/@umijs+fabric@2.14.1/node_modules/@umijs/fabric/dist/eslint.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. tests/utils.tsOops! Something went wrong! :( ESLint: 7.32.0 ESLint couldn't find the plugin "eslint-plugin-react". (The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.js » /node_modules/.pnpm/@umijs+fabric@2.14.1/node_modules/@umijs/fabric/dist/eslint.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #76 +/- ##
==========================================
+ Coverage 99.01% 99.04% +0.02%
==========================================
Files 9 9
Lines 204 209 +5
Branches 94 95 +1
==========================================
+ Hits 202 207 +5
Misses 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/utils.ts (1)
10-13: 实现的 scrollWindow 工具函数结构清晰函数实现简洁有效,提供了在测试场景中模拟窗口滚动的功能。
不过,建议在行尾添加分号以保持代码风格一致性:
export const scrollWindow = (x: number, y: number) => { window.scrollTo(x, y); - window.dispatchEvent(new Event('scroll')) + window.dispatchEvent(new Event('scroll')); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
tests/__snapshots__/index.test.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (2)
tests/index.test.tsx(2 hunks)tests/utils.ts(1 hunks)
🔇 Additional comments (1)
tests/index.test.tsx (1)
1229-1291: 测试用例实现完善,验证了滚动时面板位置更新功能测试用例结构良好,完整验证了滚动时 Tour 组件能够正确更新目标元素位置的功能:
- 首先设置初始位置并验证初始样式
- 触发滚动并检查位置是否正确更新
- 最后执行适当的清理操作
这个测试用例很好地覆盖了修复的功能点,确保当页面滚动时 Tour 组件能够跟随目标元素的位置变化。
Fixed ant-design#53071
Summary by CodeRabbit
Tour组件的测试中新增了一个测试用例,验证窗口滚动时目标占位符位置的更新,确保组件在滚动事件下的行为正确。